cmake_minimum_required(VERSION 3.20)
project(ProxyDemo VERSION 1.0.0 LANGUAGES CXX)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# 设置构建类型
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif()

# 添加编译器警告
if(MSVC)
    add_compile_options(/W4 /permissive-)
else()
    add_compile_options(-Wall -Wextra -Wpedantic)
endif()


## 使用 FetchContent 获取 Proxy 库
## 下载到 build/_deps 目录中
include(FetchContent)
FetchContent_Declare(
    msft_proxy
    GIT_REPOSITORY https://github.com/microsoft/proxy.git
    GIT_TAG        4.0.0  # 使用最新稳定版本
)
FetchContent_MakeAvailable(msft_proxy)

# 创建主可执行文件
add_executable(proxy_demo 
    main.cpp
    examples/basic_usage.cpp
    examples/polymorphism.cpp
    examples/formatting.cpp
    examples/streaming.cpp
    examples/advanced_features.cpp
)

# 链接 Proxy 库
target_link_libraries(proxy_demo PRIVATE msft_proxy4::proxy)

# 设置包含目录
target_include_directories(proxy_demo PRIVATE 
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)

# 设置输出目录
set_target_properties(proxy_demo PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)